package com.yundong.gongchengji.util;

import java.util.ArrayList;
import java.util.List;

/**
 * 集合转数组
 * Created by songjian on 2016/11/7.
 */
public class ListToArray {

    public static String[] ListToArray(List<String> list){
        String [] array = new String[list.size()];
        for (int i =0;i<list.size();i++){
            array[i] = list.get(i);
        }
        return array;
    }
    public static String[] StringToArray(String string){
        List<String> list = new ArrayList<>();
        list.add(string);
        return ListToArray(list);
    }
    public static List<String> StringToList(String[]strings){
        List<String>list=new ArrayList<String>();
        for (int i = 0; i <strings.length ; i++) {
            list.add(strings[i]);
        }
        return list;
    }
}
